class_name IState
extends RefCounted  # 使用 RefCounted 而不是 Object，更适合 Godot 4.x

var characterCtr: CharacterController = null
var stateMachine: StateMachine = null

# 进入状态
func enter() -> void:
	# 播放动画
	if characterCtr:
		characterCtr.play_character_anm(get_anm_name())

# 退出状态
func exit() -> void:
	pass  # 使用 pass 而不是空字符串

# 逻辑更新
func logic_update(_delta: float) -> void:
	pass

# 物理更新
func physics_update(_delta: float) -> void:
	assert(false, "physics_update() must be implemented in state subclasses")

# 获取状态优先级
func get_priority() -> int:
	return 0

# 获取动画名称
func get_anm_name() -> String:
	return ""

# 获取状态类型
func get_type() -> int:  # 假设 StateMachine.CharacterStates 是枚举，返回 int
	return -1  # 返回 -1 表示未知状态

# 初始化操作
func init(character_ctr: CharacterController, state_machine: StateMachine) -> void:
	self.characterCtr = character_ctr
	self.stateMachine = state_machine
